#include "ClearCellsCommand.h"
#include "FrakOutController.h"

ClearCellsCommand::ClearCellsCommand(const QString& text,
                                     FrakOutController& controller,
                                     const FrakOutDataItem& sheet,
                                     int sheetIndex) :
QUndoCommand(text), m_controller(controller), m_sheet(sheet), m_sheetIndex(sheetIndex)
{
}

void ClearCellsCommand::redo()
{
    m_controller.removeCellsForSheet(m_sheetIndex);
}

void ClearCellsCommand::undo()
{
    m_controller.setCellsForSheet(m_sheetIndex, m_sheet.cells());
}
